import Vue from 'vue'
import VueRouter from 'vue-router'
import Films from '../views/Films'
import Nowplaying from '../views/Films/children/NowPlaying.vue'
import ComingSoon from '../views/Films/children/ComingSoon.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:"/",
    redirect:"/films/nowPlaying"
  },
  {
    path: '/films',
    name: 'Films',
    component: Films,
    meta:{
      isNav:true
    },
    children:[
      {
        path:"nowPlaying",
        component:Nowplaying,
      },
      {
        path:"comingSoon",
        component:ComingSoon,
      }
    ]
  },
  {
    path: '/article',
    name: 'Article',
    component: () => import('../views/Article'),
    meta:{
      isNav:true
    }
  },{
    path:'/center',
    name:"Center",
    component: () => import('../views/Center'),
    meta:{
      isNav:true
    }
  },{
    path:'/movieDetail/:id',
    name:"MovieDetail",
    component: () => import('../views/Films/MovieDetail.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
